<?php


namespace app\controller;

use app\common\controller\BaseController;
use app\common\service\content\CategoryService;
use app\common\service\content\ContentService;
use app\common\service\setting\CarouselService;
use app\api\service\IndexService;
use hg\apidoc\annotation as Apidoc;
use think\facade\View;

/**
 * @Apidoc\Title("首页")
 * @Apidoc\Group("index")
 * @Apidoc\Sort("100")
 */
class About extends BaseController
{
    /**
     * @Apidoc\Title("首页")
     * @Apidoc\NotHeaders()
     * @Apidoc\NotQuerys()
     * @Apidoc\NotParams()
     */
    public function index()
    {
        $where = where_disdel();
        $where['category_pid'] = '1';
        $order = $this->order(['sort' => 'desc', 'category_id' => 'asc']);
        $field = 'category_id,category_pid,category_name,category_unique,image_id,small_image_id,url,sort';
        $list = CategoryService::list('tree', $where, $order, $field);
        View::assign('menuList', $list);


        View::assign('bannerUrl', 'https://www.pa0086.com/basic/images/about-banner.jpg');

        return view('index', $list);
    }
    public function company()
    {
        $where = where_disdel();
        $where['category_pid'] = '1';
        $order = $this->order(['sort' => 'desc', 'category_id' => 'asc']);
        $field = 'category_id,category_pid,category_name,category_unique,image_id,small_image_id,url,sort';
        $list = CategoryService::list('tree', $where, $order, $field);
        View::assign('menuList', $list);


        View::assign('bannerUrl', 'https://www.pa0086.com/basic/images/about-banner.jpg');

        return view('company', $list);
    }
    public function story()
    {
        $where = where_disdel();
        $where['category_pid'] = '1';
        $order = $this->order(['sort' => 'desc', 'category_id' => 'asc']);
        $field = 'category_id,category_pid,category_name,category_unique,image_id,small_image_id,url,sort';
        $list = CategoryService::list('tree', $where, $order, $field);
        View::assign('menuList', $list);


        View::assign('bannerUrl', 'https://www.pa0086.com/basic/images/about-banner.jpg');

        return view('story', $list);
    }
    public function history()
    {
        $where = where_disdel();
        $where['category_pid'] = '1';
        $order = $this->order(['sort' => 'desc', 'category_id' => 'asc']);
        $field = 'category_id,category_pid,category_name,category_unique,image_id,small_image_id,url,sort';
        $list = CategoryService::list('tree', $where, $order, $field);
        View::assign('menuList', $list);


        View::assign('bannerUrl', 'https://www.pa0086.com/basic/images/about-banner.jpg');

        return view('history', $list);
    }
    public function honors()
    {
        $pathinfo = $this->request->pathinfo(); // 获取路径信息 "news/industry?page=1"
        $path = getUrlPath($pathinfo);

        $info = CategoryService::info(18);

        $page = request()->param('page', 1);
        $menu = CategoryService::getSubMenu(6);
        View::assign('menu', $menu);



        $where[] = ['category_ids', 'in', [18]];
        $where[] = ['type', '=', 14];
        $list =   ContentService::lis($where, $page, 12);

        foreach ($list as $key => $value) {
            $date = date('Y-m-d', strtotime($value['create_time']));
            $list[$key]['create_time'] = $date;
        }

        View::assign('list', $list);
        View::assign('info', $info);

        return view('honors');
    }

    public function videos()
    {
        $idf = 28;

        $page = request()->param('page', 1);
        $where[] = ['category_ids', 'in', [$idf]];
        $where[] = ['type', '=', 16];
        $list =   ContentService::lis($where, $page, 12,[],'','video_url_list');

        View::assign('list', $list);

        return view('videos');
    }
    public function worldview()
    {
        $where = where_disdel();
        $where['category_pid'] = '1';
        $order = $this->order(['sort' => 'desc', 'category_id' => 'asc']);
        $field = 'category_id,category_pid,category_name,category_unique,image_id,small_image_id,url,sort';
        $list = CategoryService::list('tree', $where, $order, $field);
        View::assign('menuList', $list);


        View::assign('bannerUrl', 'https://www.pa0086.com/basic/images/about-banner.jpg');

        return view('worldview', $list);
    }
}
